package com.irdstudio.efp.cus.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.cus.service.dao.AcctInfoLoanDao;
import com.irdstudio.efp.cus.service.domain.AcctInfoLoan;
import com.irdstudio.efp.cus.service.facade.AcctInfoLoanService;
import com.irdstudio.efp.cus.service.vo.AcctInfoLoanVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service Impl: 公积金贷款信息表服务实现
 *
 * @author gcb
 * @date 2020-08-11
 */
@Service("acctInfoLoanService")
public class AcctInfoLoanServiceImpl implements AcctInfoLoanService, FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(AcctInfoLoanServiceImpl.class);

    @Autowired
    private AcctInfoLoanDao acctInfoLoanDao;

    /**
     * 新增数据
     *
     * @param acctInfoLoanVo
     * @return
     */
    @Override
    public int insert(AcctInfoLoanVO acctInfoLoanVo) throws Exception {
        AcctInfoLoan acctInfoLoan = new AcctInfoLoan();
        beanCopy(acctInfoLoanVo, acctInfoLoan);
        return acctInfoLoanDao.insert(acctInfoLoan);
    }

    /**
     * 根据主键删除信息
     *
     * @param acctInfoLoanVo
     * @return
     */
    @Override
    public int deleteByPk(AcctInfoLoanVO acctInfoLoanVo) throws Exception {
        AcctInfoLoan acctInfoLoan = new AcctInfoLoan();
        beanCopy(acctInfoLoanVo, acctInfoLoan);
        return acctInfoLoanDao.deleteByPk(acctInfoLoan);
    }

    /**
     * 根据主键更新信息
     *
     * @param acctInfoLoanVo
     * @return
     */
    @Override
    public int updateByPk(AcctInfoLoanVO acctInfoLoanVo) throws Exception {
        AcctInfoLoan acctInfoLoan = new AcctInfoLoan();
        beanCopy(acctInfoLoanVo, acctInfoLoan);
        return acctInfoLoanDao.updateByPk(acctInfoLoan);
    }

    /**
     * 根据主键查询详情
     *
     * @param inAcctInfoLoanVo
     * @return
     */
    @Override
    public AcctInfoLoanVO queryByPk(AcctInfoLoanVO inAcctInfoLoanVo) throws Exception {
        AcctInfoLoan queryAcctInfoLoan = new AcctInfoLoan();
        beanCopy(inAcctInfoLoanVo, queryAcctInfoLoan);
        AcctInfoLoan queryRslAcctInfoLoan = acctInfoLoanDao.queryByPk(queryAcctInfoLoan);
        return beanCopy(queryRslAcctInfoLoan, new AcctInfoLoanVO());
    }
}
